#include "globalhotkeys.h"
#include <QHotkey>

GlobalHotkeys::GlobalHotkeys(QObject *parent) : QObject(parent)
{
    // 创建全局快捷键实例
    minimizeHotkey = new QHotkey(QKeySequence("Ctrl+M"), true, this);
    restoreHotkey = new QHotkey(QKeySequence("Ctrl+R"), true, this);

    // 连接快捷键触发的槽函数
    connect(minimizeHotkey, &QHotkey::activated, this, &GlobalHotkeys::minimizeWindow);
    connect(restoreHotkey, &QHotkey::activated, this, &GlobalHotkeys::restoreWindow);
}

void GlobalHotkeys::minimizeWindow()
{
    emit minimizeRequested();
}

void GlobalHotkeys::restoreWindow()
{
    emit restoreRequested();
}
